<%--
  Created by IntelliJ IDEA.
  User: 陈帅玺
  Date: 2019-02-24
  Time: 18:31
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<c:set var="path" value="${pageContext.request.contextPath}"></c:set>
<link rel="stylesheet" href="${path}/layui/css/layui.css">
<link rel="stylesheet" href="/layui/css/formSelects-v4.css" media="all ">
<script src="${path}/layui/layui.js"></script>
<script src="${path}/js/jquery.min.js"></script>
<body>
<div id="chatEdits" style="margin-top: 20px;display: none">
    <form class="layui-form" id="chatEditForms" lay-filter="chatEditForms">
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">客户编号：</label>
                <div class="layui-input-inline">
                    <input type="text" name="ontline" id="bianhao" class="layui-input" readonly>
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">客户名：</label>
                <div class="layui-input-inline">
                    <input type="text" name="beizhu" id="name" class="layui-input" readonly>
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">负责人：</label>
                <div class="layui-input-inline">
                    <input type="text" name="ontline" id="user" class="layui-input" readonly>
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">客户等级：</label>
                <div class="layui-input-inline">
                    <input type="text" name="beizhu" id="level" class="layui-input" readonly>
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">客户信用度：</label>
                <div class="layui-input-inline">
                    <input type="text" name="ontline" id="xyd" class="layui-input" readonly>
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">客户满意度：</label>
                <div class="layui-input-inline">
                    <input type="text" name="beizhu" id="myd" class="layui-input" readonly>
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <%--<div class="layui-inline">--%>
                <%--<label class="layui-form-label">上次购买时间：</label>--%>
                <%--<div class="layui-input-inline">--%>
                    <%--<input type="text" name="ontline" id="stimer" class="layui-input" readonly>--%>
                <%--</div>--%>
            <%--</div>--%>
                <div class="layui-inline">
                    <label class="layui-form-label">流失时间：</label>
                    <div class="layui-input-inline">
                        <input type="text" name="ontline" id="ltimer" class="layui-input" readonly>
                    </div>
                </div>
            <div class="layui-inline">
                <label class="layui-form-label">流失内容：</label>
                <div class="layui-input-inline">
                    <input type="text" name="beizhu" id="neirong" class="layui-input" readonly>
                </div>
            </div>
        </div>
        <div class="layui-form-item">

            <div class="layui-inline">
                <label class="layui-form-label">状态：</label>
                <div class="layui-input-inline">
                    <input type="text" name="beizhu" id="zhuangtai" class="layui-input" readonly>
                </div>
            </div>
        </div>
    </form>
</div>
    <h2>客户资源管理</h2>
    <hr>
    <form class="layui-form" action="">
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">客户名:</label>
                <div class="layui-input-inline" style="width: 200px">
                    <input id="username" type="text" autocomplete="off" class="layui-input">
                </div>
                <div class="layui-input-inline" style="width: 200px">
                    <button type="button" class="layui-btn" onclick="SearchData();"><i class="layui-icon layui-icon-search"></i>查询</button>
                </div>
            </div>
        </div>
    </form>
    <div class="layui-fluid">
        <table id="cusTable" lay-filter="cusTable"></table>
    </div>
    <script>
        layui.use(["table","form"],function () {
            var table=layui.table;
            table.render({
                elem:"#cusTable",
                url:"${path}/loss/list",
                page:true,
                toolbar:'#toolbarDemo',
                cols:[[
                    {field:'custId',title:'客户编号'},
                    {field:'custname',title:'客户名称'},
                    {field:'level',title:'客户类型'},
                    {templet:'#stat',title:'状态'},
                    {field:'userid',title:'负责人'},
                    {toolbar:'#barDemo',title:'操作'}
                ]]

            })
            table.on('tool(cusTable)',function (obj) {
                var data=obj.data;
                switch (obj.event) {
                    case "select":
                        console.log(data)
                        layer.open({
                            type: 1,
                            title: "详细内容",
                            skin: "layui-layer-molv",
                            anim: 0,
                            offset:"200px",
                            area: "800px",
                            content: $("#chatEdits"),
                            btn: ['返回'],
                            success: function () {
                                $("#bianhao").val(data.custId);
                                $("#name").val(data.custname);
                                $("#user").val(data.userid);
                                $("#level").val(data.level);
                                $("#xyd").val(data.satisfied);
                                $("#myd").val(data.credit);
                                $("#stimer").val(data.uptime);
                                $("#neirong").val(data.reason);
                                $("#ltimer").val(data.lasttime);
                                $("#zhuangtai").val(data.dictionariesstat.name);
                            }
                        });
                        break;
                }
            })
        })
        function SearchData() {
            layui.table.reload("cusTable",{
                page:{
                    curr:1
                },
                where:{
                    "custname":$("#username").val()
                }
            })
        }
    </script>
</body>

    <script type="text/html" id="stat">
        {{d.dictionariesstat.name}}
    </script>
<script type="text/html" id="barDemo">
    <a class="layui-btn layui-btn-xs " lay-event="select" title="查看"><span class="layui-icon layui-icon-list"></span></a>
</script>
</html>
